package com.ruoyi.system.service.gallery.impl;

import java.util.List;

import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.system.domain.gallery.GalleryOriginal;
import com.ruoyi.system.mapper.gallery.GalleryOriginalMapper;
import com.ruoyi.system.service.gallery.GalleryOriginalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * 图库案例原文Service业务层处理
 * 
 * @author 张少丛
 * @date 2020-11-30
 */
@Service
public class GalleryOriginalServiceImpl implements GalleryOriginalService
{
    @Autowired
    private GalleryOriginalMapper galleryOriginalMapper;

    /**
     * 查询图库案例原文
     * 
     * @param galleryOriginalId 图库案例原文ID
     * @return 图库案例原文
     */
    @Override
    public GalleryOriginal selectGalleryOriginalById(Long galleryOriginalId)
    {
        return galleryOriginalMapper.selectGalleryOriginalById(galleryOriginalId);
    }

    /**
     * 查询图库案例原文列表
     * 
     * @param galleryOriginal 图库案例原文
     * @return 图库案例原文
     */
    @Override
    public List<GalleryOriginal> selectGalleryOriginalList(GalleryOriginal galleryOriginal)
    {
        return galleryOriginalMapper.selectGalleryOriginalList(galleryOriginal);
    }

    /**
     * 校验图库案例是否唯一
     * @param galleryInfoId
     * @return
     */
    public String checkGalleryOriginalById(Long galleryInfoId){
        int row =  galleryOriginalMapper.checkGalleryOriginalById(galleryInfoId);
        if (row > 0)
        {
            return UserConstants.NOT_UNIQUE;
        }
        return UserConstants.UNIQUE;
    }

    /**
     * 新增图库案例原文
     * 
     * @param galleryOriginal 图库案例原文
     * @return 结果
     */
    @Override
    public int insertGalleryOriginal(GalleryOriginal galleryOriginal)
    {
        return galleryOriginalMapper.insertGalleryOriginal(galleryOriginal);
    }

    /**
     * 修改图库案例原文
     * 
     * @param galleryOriginal 图库案例原文
     * @return 结果
     */
    @Override
    public int updateGalleryOriginal(GalleryOriginal galleryOriginal)
    {
        return galleryOriginalMapper.updateGalleryOriginal(galleryOriginal);
    }

    /**
     * 批量删除图库案例原文
     * 
     * @param galleryOriginalIds 需要删除的图库案例原文ID
     * @return 结果
     */
    @Override
    public int deleteGalleryOriginalByIds(Long[] galleryOriginalIds)
    {
        return galleryOriginalMapper.deleteGalleryOriginalByIds(galleryOriginalIds);
    }

    /**
     * 删除图库案例原文信息
     * 
     * @param galleryOriginalId 图库案例原文ID
     * @return 结果
     */
    @Override
    public int deleteGalleryOriginalById(Long galleryOriginalId)
    {
        return galleryOriginalMapper.deleteGalleryOriginalById(galleryOriginalId);
    }
}
